package com.hdoit.apollo.logical.stock.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.hdoit.apollo.logical.cargo.model.Cargo;
import com.hdoit.apollo.logical.stock.dao.IOutStockCollocationDao;
import com.hdoit.apollo.logical.stock.mapper.OutStockCollocationMapper;
import com.hdoit.apollo.logical.stock.model.OutStockCollocation;
import com.hdoit.apollo.logical.viewmodel.billing.BillingSearch;
import com.hdoit.apollo.logical.viewmodel.billing.BillingStat;
import com.hdoit.apollo.logical.viewmodel.billing.BillingDetailed;
import com.tennetcn.data.dao.base.ISqlExpression;
import com.tennetcn.data.dao.base.impl.SuperDao;
import com.tennetcn.data.message.PagerModel;
import com.tennetcn.data.utils.SqlExpressionFactory;
/**
 * @author      humaoshu
 * @email       
 * @createtime  2018年04月02日 14:14:34
 * @comment
 */
@Component
public class OutStockCollocationDaoImpl extends SuperDao<OutStockCollocation> implements IOutStockCollocationDao{

	@Autowired
	private OutStockCollocationMapper outStockCollocationMapper;
	
	@Override
	public boolean deleteOutStockShowCollocation(String showId) {
		ISqlExpression sqlExpression = SqlExpressionFactory.createExpression();
		sqlExpression.addBody("delete from",OutStockCollocation.class)
					.andWhere("showId=#{showId}")
					.setParam("showId", showId);
		return delete(sqlExpression)>=0;
	}

	@Override
	public List<BillingDetailed> queryListByDetailed(BillingSearch search,PagerModel pagerModel) {
		
		return outStockCollocationMapper.queryListByDetailed(search,pagerModel);
	}

	@Override
	public BillingStat querySummaryStat(BillingSearch search) {
		
		return outStockCollocationMapper.querySummaryStat(search);
	}

	@Override
	public int queryCountByDetailed(BillingSearch search) {
		
		return outStockCollocationMapper.queryCountByDetailed(search);
	}

	@Override
	public List<BillingStat> queryListBySummary(BillingSearch search, PagerModel pagerModel) {
		
		return outStockCollocationMapper.queryListBySummary(search, pagerModel);
	}

	@Override
	public int queryCountBySummary(BillingSearch search) {
		
		return outStockCollocationMapper.queryCountBySummary(search);
	}

	@Override
	public OutStockCollocation queryModelByBilling(String collocationId,
			String billingId) {
		return outStockCollocationMapper.queryModelByBilling(collocationId,billingId);
	}

	@Override
	public List<Cargo> querySaleCargoList(BillingSearch search) {
		return outStockCollocationMapper.querySaleCargoList(search);
	}

}